<template>
  <div>
    <el-row>
      <el-col :span="24" class="main-h-center">
        <el-card style="width:450px;margin-top:20px;" shadow="never">
          <el-form label-position="right" label-width="50px" style="padding-top: 30px;">
            <el-form-item label="角色">
              <el-select placeholder="选择角色类型" v-model="postData.role">
                <el-option label="用户" value="1"></el-option>
              </el-select>
            </el-form-item>
            <el-form-item label="用户">
              <el-input v-model="postData.username" placeholder="请输入用户名"></el-input>
            </el-form-item>
            <el-form-item label="密码">
              <el-input v-model="postData.password" placeholder="请输入登录密码"></el-input>
            </el-form-item>
            <el-form-item label="昵称">
              <el-input v-model="postData.nick" placeholder="请输入用户昵称"></el-input>
            </el-form-item>
            <el-form-item label="积分">
              <el-input v-model="postData.integral" placeholder="请输入积分" type="number"></el-input>
            </el-form-item>
            <el-form-item label="QQ">
              <el-input v-model="postData.qq" placeholder="请输入用户QQ" type="number"></el-input>
            </el-form-item>
            <el-form-item label="微信">
              <el-input v-model="postData.wx" placeholder="请输入用户微信"></el-input>
            </el-form-item>
            <el-form-item label="手机">
              <el-input v-model="postData.tel" placeholder="请输入用户手机" type="number"></el-input>
            </el-form-item>
            <el-form-item label="邮箱">
              <el-input v-model="postData.email" placeholder="请输入E-mail"></el-input>
            </el-form-item>
            <el-form-item label="备注">
              <el-input v-model="postData.bdinfo" placeholder="请输入备注"></el-input>
            </el-form-item>
            <el-form-item style="margin-bottom: 0;">
              <el-button id="btn" type="primary" @click="handleAdd" style="float:right">立即添加</el-button>
            </el-form-item>
          </el-form>
        </el-card>
      </el-col>
    </el-row>
  </div>
</template>
<script>
import Clipboard from "clipboard";
export default {
  data() {
    return {
      postData: {
        role:"1",
        username:"",
        password:"",
        nick:"",
        integral:"",
        qq:"",
        wx:"",
        tel:"",
        email:"",
        bd_info:"",
      },
      keyCategory: [],
      keyData: ""
    };
  },
  methods: {
    handleAdd() {
      this.$http
        .post("/user/create", this.postData)
        .then(res => {
          if (res.code==200) {
            this.$message({
              message: res.msg,
              type: "success"
            });
          } else {
            this.$message.error(res.msg);
          }
        })
        .catch(err => {
          this.$message.error(err.msg);
        });
    }
  }
};
</script>
<style>
</style>

